<?php
namespace app\home\controller;

class Index
{
    public function index()
    {
        set_time_limit (0);
        vendor("PHPExcel.PHPExcel.PHPExcel");
        vendor("PHPExcel.PHPExcel.Writer.IWriter");
        vendor("PHPExcel.PHPExcel.Writer.Abstract");
        vendor("PHPExcel.PHPExcel.Writer.Excel5");
        vendor("PHPExcel.PHPExcel.Writer.Excel2007");
        vendor("PHPExcel.PHPExcel.IOFactory");
        $cp  = \PHPExcel_CachedObjectStorageFactory::cache_to_phpTemp;
        $cacheSettings = array( ' memoryCacheSize ' => '8MB');
        \PHPExcel_Settings::setCacheStorageMethod($cp, $cacheSettings);
        $objReader = \PHPExcel_IOFactory::createReader('Excel2007');
        $filename = 'cjd.xlsx';
        $PHPExcel = $objReader->load($filename, $encode = 'utf-8');
        $sheet = $PHPExcel->getSheet(8);
        $highestRow = $sheet->getHighestRow();//获取总行数
        dump($highestRow);
    }
}
